<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:replace="_fragments :: head(~{::title})">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>首页</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/semantic-ui/2.2.10/semantic.min.css">
    <link rel="stylesheet" href="../static/css/me.css"> <!--引入自定义CSS样式-->
</head>
<body>
    <!--导航-->
    <nav th:replace="_fragments :: menu(1)" class="ui inverted attached segment me-padded-tb-mini me-shadow-small"> <!--引入css样式-->

    </nav>

    <!--中间内容-->
    <div class="me-container me-padded-tb-huge">
        <div class="ui container"> <!--container响应式效果，根据屏幕选择最适合的显示-->
            <div class="ui grid stackable">
                <!--左边文章列表-->
                <div class="eleven wide column ">
                    <!--头部-->
                    <div class="ui top attached segment"><!--attached和下面的segment相连-->
                        <div class="ui two column grid middle aligned"><!--指定两行的网格，垂直方向居中-->
                            <div class="column">
                                <h3 class="ui teal header">博客</h3>
                            </div>
                            <div class="column right aligned">
                                共 <h2 class="ui orange header me-inline-block me-text-thin" th:text="${page.totalElements}"> 14 </h2> 篇 <!--h为块，自动换行，需要自己写样式-->
                            </div>
                        </div>
                    </div>

                    <!--文章列表-->
                    <div class="ui attached segment">
                        <div class="ui me-padded-huge me-padded-tb-medium vertical segment" th:each="blog: ${page.content}"><!--padded上下边距，vertical两个之间加横线-->
                            <div class="ui middle aligned grid stackable mobile reversed">
                                <div class="eleven wide column">
                                    <a href="#" th:href="@{/blog/{id}(id=${blog.id})}">
                                            <span>
                                                <h3 th:text="${blog.title}" class="ui header">你真的理解什么是财富自由嘛</h3>
                                                <p class="me-text me-black" th:text="${blog.description}">啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦
                                                    啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦啦 <!--字符串连接-->
                                                </p> <!--段落内容-->
                                            </span>
                                    </a>
                                    <p>&nbsp</p>
                                    <div class="ui grid">
                                        <div class="eleven wide column">
                                            <div class="ui mini horizontal link list">
                                                <div class="item"><!--图标？？-->
                                                    <img th:src="@{${blog.user.avatar}}" alt="" class="ui avatar image"><!--avatar, 小图片-->
                                                    <div class="content">
                                                        <a href="#" class="header" th:text="${blog.user.nickname}">泽宝宝</a>
                                                    </div>
                                                </div>
                                                <div class="item">
                                                    <i class="calendar icon"></i><span th:text="${#dates.format(blog.updateTime, 'yyyy-MM-dd')}">2020-05-24</span>
                                                </div>
                                                <div class="item">
                                                    <i class="eye icon"></i><span th:text="${blog.views}">2342</span>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="right aligned five wide column">
                                            <a href="#" class="ui teal basic me-padded-small label me-opacity-mini" th:text="${blog.type.name}">认知升级</a>
                                        </div>
                                    </div>
                                </div>
                                <div class="five wide column">
                                    <a href="#" th:href="@{/blog/{id}(id=${blog.id})}" target="_blank">
                                        <img th:src="@{${blog.firstPicture}}" alt="" class="ui rounded image">
                                    </a>
                                </div>
                            </div>
                        </div>
                    </div>
                    
                    <!--底部-->
                    <div class="ui bottom attached segment" th:if="${page.totalPages}>1">
                        <div class="ui two column grid">
                            <div class="column">
                                <a href="#" class="ui teal basic button" th:href="@{/(page=${page.number}-1)}" th:unless="${page.first}">上一页</a><!--basic -->
                            </div>
                            <div class="column right aligned">
                                <a href="#" class="ui teal basic button" th:href="@{/(page=${page.number}+1)}" th:unless="${page.last}">下一页</a><!--basic -->
                            </div>
                        </div>
                    </div>
                </div>

                <!--右边分类及标签-->
                <div class="five wide column">

                    <!--分类-->
                    <div class="ui segments"><!--多个segments-->
                        <div class="ui secondary segment">
                            <div class="ui two column grid">
                                <div class="column">
                                    <i class="idea icon"></i>分类
                                </div>
                                <div class="column right aligned">
                                    <a href="#" th:href="@{types/-1}" target="_blank">more<i class="angle double right icon"></i></a>
                                </div>
                            </div>
                        </div>
                        <div class="ui teal segment"> <!--可以中间划线-->
                            <div class="ui fluid vertical menu" ><!--fluid填充外部容器，竖着的menu-->
                                <a href="#" th:href="@{/types/{id}(id=${type.id})}" class="item me-text-thin me-text-space" th:each="type: ${types}">
                                    <span th:text="${type.name}">学习日志</span>
                                    <div class="ui teal basic left pointing label" th:text="${type.publishedBlogs}">13</div> <!--文字后面的div, 自动放在最右边-->
                                </a>
                            </div>
                        </div>
                    </div>

                    <!--标签-->
                    <div class="ui segments me-margin-top-medium">
                        <div class="ui secondary segment">
                            <div class="ui two column grid">
                                <div class="column">
                                    <i class="tags icon"></i>标签
                                </div>
                                <div class="right aligned column">
                                    <a href="#" th:href="@{tags/-1}" target="_blank">more<i class="angle double right icon"></i></a>
                                </div>
                            </div>
                        </div>
                        <div class="ui teal segment">
                            <a href="#" th:href="@{/tags/{id}(id=${tag.id})}" target="_blank" class="ui teal basic label me-margin-tb-tiny" th:each="tag: ${tags}"><!--margin定义外部间隔-->
                                <span th:text="${tag.name}">方法论</span><div class="detail" th:text="${tag.publishedBlogs}">22</div>
                            </a>
                        </div>

                    </div>

                    <!--最新推荐-->
                    <div class="ui segments me-margin-top-medium">
                        <div class="ui secondary segment">
                            <i class="bookmark icon"></i>最新推荐
                        </div>
                        <div class="ui segment" th:each="blog: ${recommendBlogs}">
                            <a href="#" th:href="@{/blog/{id}(id=${blog.id})}" target="_blank" class="me-black me-text-thin" th:text="${blog.title}">用户故事</a>
                        </div>
                        <!--/*-->
                        <div class="ui segment">
                            <a href="#" target="_blank" class="me-black me-text-thin">用户故事</a>
                        </div>
                        <div class="ui segment">
                            <a href="#" target="_blank" class="me-black me-text-thin">用户故事</a>
                        </div>
                        <div class="ui segment">
                            <a href="#" target="_blank" class="me-black me-text-thin">用户故事</a>
                        </div>
                        <div class="ui segment">
                            <a href="#" target="_blank" class="me-black me-text-thin">用户故事</a>
                        </div>
                        <div class="ui segment">
                            <a href="#" target="_blank" class="me-black me-text-thin">用户故事</a>
                        </div>
                        <div class="ui segment">
                            <a href="#" target="_blank" class="me-black me-text-thin">用户故事</a>
                        </div>
                        <div class="ui segment">
                            <a href="#" target="_blank" class="me-black me-text-thin">用户故事</a>
                        </div>
                        <!--*/-->
                    </div>
                    <!--二维码-->
                    <h4 class="ui horizontal divider header me-margin-top-medium">扫码关注我</h4><!--分割线-->
                    <div class="ui centered card"  style="width: 11em"><!--centered组件居中-->
                        <img th:src="@{images/wechat.jpg}" alt="" class="ui rounded image">
                    </div>
                </div>
            </div>
        </div>
        <br>
        <br>
    </div>

    <!--底部footer-->
    <footer th:replace="_fragments :: footer" class="ui inverted vertical segment me-padded-tb-max"><!--vertical消除圆角，用attached好像也行-->
    </footer>

    <th:block th:replace="_fragments :: script"></th:block>
    <script>

        /*下拉框*/
        $('.ui.dropdown').dropdown({
            on: 'hover' //鼠标放上就触发
        });

        $('.menu.toggle').click(function () {
            $('.m-item').toggleClass('me-mobile-hide');/*toggleClass，取反函数*/
        });

        //要加后面的""里的地址
        $('#newBlog-container').load(/*[[@{/footer/newBlogs}]]*/"/footer/newBlogs");
    </script>

</body>
</html>